﻿using System;
using System.Data;

namespace TfsReports.Web.Models
{
    /// <summary>
    /// Churn
    /// </summary>
    public class Churn
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Churn"/> class.
        /// </summary>
        public Churn(){}

        /// <summary>
        /// Initializes a new instance of the <see cref="Churn"/> class.
        /// </summary>
        /// <param name="dataRecord">The data record.</param>
        public Churn(IDataRecord dataRecord)
        {
            Id = dataRecord.GetInt32(dataRecord.GetOrdinal("ChurnId"));
            Date = dataRecord.GetDateTime(dataRecord.GetOrdinal("Date"));
            Change = new Change(dataRecord);
            Person = new Person(dataRecord);
            Changeset = new Changeset(dataRecord);
            WorkItem = new WorkItem(dataRecord);
        }

        /// <summary>
        /// Gets or sets the id.
        /// </summary>
        /// <value>The id.</value>
        public int Id { get; set; }

        /// <summary>
        /// Gets or sets the date.
        /// </summary>
        /// <value>The date.</value>
        public DateTime Date { get; set; }

        /// <summary>
        /// Gets or sets the change.
        /// </summary>
        /// <value>The change.</value>
        public Change Change { get; set; }

        /// <summary>
        /// Gets or sets the person.
        /// </summary>
        /// <value>The person.</value>
        public Person Person { get; set; }

        /// <summary>
        /// Gets or sets the changeset.
        /// </summary>
        /// <value>The changeset.</value>
        public Changeset Changeset { get; set; }

        /// <summary>
        /// Gets or sets the work item.
        /// </summary>
        /// <value>The work item.</value>
        public WorkItem WorkItem { get; set; }
    }

}
